package org.alex.samples.TestUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.alex.samples.model.ExamTestVO;

public class TestUtils {

	public static Map<Integer,Integer> getTestCountByScore(Integer totalTestCount, Map<Integer, Integer> testTypeScoreMap){
		
		Map<Integer,Integer> testTypeTestCount = new HashMap<Integer,Integer>();
		
		for(Integer key : testTypeScoreMap.keySet()){
			if(testTypeScoreMap.get(key) == 10){
				testTypeTestCount.put(key, 4);
			}else if(testTypeScoreMap.get(key) == 20){
				testTypeTestCount.put(key, 3);
			}
		}
				
		return testTypeTestCount;
	}
	
	public static List<Integer> getRandomTestIdList(List<ExamTestVO> testList,Integer  count){
		List<Integer> RandomTestIdList = new ArrayList<Integer>();
		int size = testList.size();
		Collections.shuffle(testList);
		if(size >= count){
			for(int i=0; i<count; i++){
				RandomTestIdList.add(testList.get(i).getId());
			}
			return RandomTestIdList;
		}else{	
			return null;
		}
		
	}
	
}
